﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;

namespace SiteManager.Core.Security
{
    public enum EncryptType
    {
        MD5,
        SHA1
    }

    /// <summary>
    /// 字符加密
    /// </summary>
    public class Encryption
    {
        public static string Format(string str, EncryptType type)
        {
            switch (type)
            {
                default:
                    return FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5");
                case EncryptType.SHA1:
                    return FormsAuthentication.HashPasswordForStoringInConfigFile(str, "SHA1");
            }
        }
    }
}